package com.plant.es.test.client_version;

import com.plant.es.test.client_version.handler.EsHandler;
import com.plant.es.test.client_version.handler.action.DocRelatedQuery;
import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;


public class EsClient {
    public static void main(String[] args) throws Exception {
        RestHighLevelClient esClient = new RestHighLevelClient(
                RestClient.builder(new HttpHost("127.0.0.1", 9200, "http")));
        //1.索引相关操作
//        EsHandler esHandler = new EsHandler(new IndexRelated(), esClient);
        //2.文档相关操作
//        EsHandler esHandler = new EsHandler(new DocRelated(), esClient);
        //3.批量文档操作
//        EsHandler esHandler = new EsHandler(new DocRelatedMuti(), esClient);
        //4.组合查询
        EsHandler esHandler = new EsHandler(new DocRelatedQuery(), esClient);


        esHandler.process();
        esClient.close();
    }
}
